package options

import "github.com/spf13/pflag"

type NacosConfig struct {
	Host      string `mapstructure:"host" json:"host"`
	Port      uint64 `mapstructure:"port" json:"port"`
	Namespace string `mapstructure:"namespace" json:"namespace"`
	User      string `mapstructure:"user" json:"user"`
	Password  string `mapstructure:"password" json:"password"`
	DataId    string `mapstructure:"dataid" json:"dataid"`
	Group     string `mapstructure:"group" json:"group"`
}

func NewNacosConfig() *NacosConfig {
	return &NacosConfig{
		Host:      "127.0.0.1",
		Port:      8848,
		Namespace: "public",
		User:      "nacos",
		Password:  "nacos",
		DataId:    "flow",
		Group:     "sentinel-go",
	}
}
func (o *NacosConfig) Validate() []error {
	errs := []error{}
	return errs
}
func (o *NacosConfig) AddFlags(fs *pflag.FlagSet) {
	fs.StringVar(&o.Host, "nacos.host", o.Host,
		"nacos address, if left , default is 127.0.0.1")
	fs.Uint64Var(&o.Port, "nacos.port", o.Port,
		"nacos Port, if left , default is 8848")
	fs.StringVar(&o.Namespace, "nacos.namespace", o.Namespace,
		"nacos Namespace, if left , default is public")
	fs.StringVar(&o.User, "nacos.user", o.User,
		"nacos User, if left , default is nacos")
	fs.StringVar(&o.Password, "nacos.password", o.Password,
		"nacos Password, if left , default is nacos")
	fs.StringVar(&o.DataId, "nacos.dataid", o.DataId,
		"nacos DataId, if left , default is flow")
	fs.StringVar(&o.Group, "nacos.group", o.Group,
		"nacos Group, if left , default is sentinel-go")

}
